class ClientstatusesController < ApplicationController
  layout "application"
  # GET /clientstatuses
  # GET /clientstatuses.xml
  def index
    @clientstatuses = Clientstatus.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @clientstatuses }
    end
  end

  # GET /clientstatuses/1
  # GET /clientstatuses/1.xml
  def show
    @clientstatus = Clientstatus.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @clientstatus }
    end
  end

  # GET /clientstatuses/new
  # GET /clientstatuses/new.xml
  def new
    @clientstatus = Clientstatus.new(params[:clientstatus])
    if request.post? and @clientstatus.save
      flash[:notice] = "Client Status #{@clientstatus.name} has been created"
      @clientstatus = Clientstatus.new
    end
  end

  # GET /clientstatuses/1/edit
  def edit
    @clientstatus = Clientstatus.find(params[:id])
  end

  # POST /clientstatuses
  # POST /clientstatuses.xml
  def create
    @clientstatus = Clientstatus.new(params[:clientstatus])

    respond_to do |format|
      if @clientstatus.save
        flash[:notice] = 'Clientstatus was successfully created.'
        format.html { redirect_to(@clientstatus) }
        format.xml  { render :xml => @clientstatus, :status => :created, :location => @clientstatus }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @clientstatus.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /clientstatuses/1
  # PUT /clientstatuses/1.xml
  def update
    @clientstatus = Clientstatus.find(params[:id])

    respond_to do |format|
      if @clientstatus.update_attributes(params[:clientstatus])
        flash[:notice] = 'Clientstatus was successfully updated.'
        format.html { redirect_to(@clientstatus) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @clientstatus.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /clientstatuses/1
  # DELETE /clientstatuses/1.xml
  def delete
    @clientstatus = Clientstatus.find(params[:id])
    @clientstatus.destroy

    respond_to do |format|
      format.html { redirect_to(clientstatuses_url) }
      format.xml  { head :ok }
    end
  end
end
